﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web;

namespace h2sbk_sharp.DoNetExt
{
    public static class HttpResponseMessageExt
    {
        public static HttpResponseMessage ToHttpResponseMessage(this object obj, HttpStatusCode httpStatusCode = HttpStatusCode.OK)
        {
            HttpResponseMessage Result = new HttpResponseMessage();
            Result.StatusCode = httpStatusCode;
            Result.Content = new StringContent(obj.ToJson(), Encoding.GetEncoding("UTF-8"), "application/json");
            return Result;
        }
    }
}